<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <link rel="Shortcut Icon" href="../images/aecc.ico" type="image/x-icon" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="../StaticFiles/element-ui/element-ui.css">
  <link rel="stylesheet" href="../StaticFiles/nprogress/nprogress.min.css">
  <link rel="stylesheet" href="../styles/vue-page-common.css">
  <script src="../Scripts/vue.min.js"></script>
  <script src="../StaticFiles/element-ui/element-ui.js"></script>
  <script src="../Scripts/axios.min.js"></script>
  <script src="../StaticFiles/nprogress/nprogress.min.js"></script>
  <script src="../Scripts/dayjs.min.js"></script>
  <script src="../Scripts/axios.config.js"></script>
  <script src="../Scripts/datav.min.vue.js"></script>
  <title>生产完成情况看板</title>
  <style>
    .card-header-title {
      font-size: 20px;
      font-weight: bold;
      text-align: center;
    }
  </style>
</head>

<body>
  <div id="app" v-cloak v-on:keyup.enter="getData">
    <el-row class="header">
      <el-col :span="6"><img src="../images/aeec_logo.png" height="60" alt="黎阳LOGO" /></el-col>
      <el-col :span="12" class="header-title" id="">{{title}}</el-col>
      <el-col :span="6" class="currentTime">{{currentTime}}</el-col>
    </el-row>

    <div style="padding:10px;">
      <el-form :inline="true" :model="queryInfo" :label-position="'left'">
        <el-form-item label="主制分厂:">
          <el-select v-model="queryInfo.factoryid" placeholder="请选择主制分厂" filterable @change="factorySelectChange">
            <el-option v-for="f in factoryList" :key="f.factoryid" :label="f.factoryname" :value="f.factoryid">
            </el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="筛选时间:">
          <el-date-picker v-model="queryInfo.selectdate" type="daterange" range-separator="至" value-format="yyyy-MM-dd"
            start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions"></el-date-picker>
        </el-form-item>

        <el-form-item style="height:40px;">
          <el-button type="primary" @click="handleBtnSearch" icon="el-icon-search" size="small">查询</el-button>
        </el-form-item>
      </el-form>

      <el-row>
        <el-col :span="12">
          <el-card>
            <div slot="header">
              <div class="card-header-title">工序计划排产完成情况</div>
            </div>
            <div>
              <div style="height: 250px;" id="stepPlanChart"></div>
            </div>
          </el-card>
        </el-col>
        <el-col :span="12">
          <el-card>
            <div slot="header">
              <div class="card-header-title">转工计划排产完成情况</div>
            </div>
            <div>
              <div style="height: 250px;" id="shipPlanChart"></div>
            </div>
          </el-card>
        </el-col>
      </el-row>

      <el-card>
        <div slot="header">
          <div class="card-header-title">工区协作</div>
        </div>
        <div>
          <div style="height: 250px;" id="workcenterCoopChart"></div>
        </div>
      </el-card>

      <el-card>
        <div slot="header">
          <div class="card-header-title">问题上报</div>
        </div>
        <div>
          <div style="height: 250px;" id="problemChart"></div>
        </div>
      </el-card>

      <!-- 回到顶部 -->
      <el-backtop></el-backtop>
    </div>
  </div>
  <script src="../Scripts/echarts/echarts-5.4.0.min.js"></script>
  <script type="module">
    import { getParams } from '../Scripts/hooks/useCommonMethod.js'
    import { prevWeek, thisWeek, nextWeek, prevMonth, thisMonth, nextMonth } from '../Scripts/hooks/useDateShortCut.js'
    const app = new Vue({
      el: '#app',
      data: {
        currentTime: '',// 当前时间
        queryInfo: {
          factoryid: '', //主制分厂
          factoryname: '', //分厂
          selectdate: ''
        },
        loading: false,
        loadingText: '拼命加载中',
        factoryList: [],
        userInfo: {},
        pickerOptions: { shortcuts: [prevWeek, thisWeek, nextWeek, prevMonth, thisMonth, nextMonth] }
      },
      methods: {
        async getUserInfo(employeeid) {
          const { data: res } = await axios.post('../handler/report/EmployeeWorkTimeCountReport.ashx?action=getUserInfo', {
            type: 'getUserInfo',
            employeeid
          })
          if (res.meta.status === 500) {
            return this.$message.error(res.meta.msg)
          }
          this.userInfo = res.data[0];
        },
        async getFactoryList() {
          const { data: res } = await axios({
            method: 'POST',
            url: '../handler/report/CommonActionHandle.ashx?action=getFactoryListByCode',
            data: { type: 'getFactoryListByCode', factoryCode: '601|607|609|600|608|602' }
          })
          this.factoryList = res.data;
        },
        async getStepPlanChartData() {
          this.loading = true
          this.loadingText = '数据加载中...'
          echarts.dispose(document.getElementById("stepPlanChart"));
          let chart = echarts.init(document.getElementById('stepPlanChart'));
          chart.showLoading({
            text: '数据查询中...',
            effect: 'whirling',
            maskColor: 'transparent',
            textColor: '#ffffff'
          });

          const { data: res } = await axios({
            url: '../handler/board/StatusOfProductionDashBoard.ashx?actions=getStepPlanChartData',
            method: 'post',
            data: {
              type: 'getStepPlanChartData',
              ...this.queryInfo
            }
          })

          this.loading = false
          chart.hideLoading();
          if (res.meta.status === 500) {
            return this.$message.error(res.meta.msg)
          }
          let arrWorkcenter = [], arrSpecCount = [], arrIntimeFinishCount = [], arrDelayfinishedSum = [], arrNotFinishCount = [], arrFinishRate = [];

          res.data.forEach(i => {
            arrWorkcenter.push(i.workcentername);
            arrSpecCount.push(i.speccount);
            arrIntimeFinishCount.push(i.intimefinishcount);
            arrDelayfinishedSum.push(i.delayfinishedsum);
            arrNotFinishCount.push(i.notfinishcount);
            arrFinishRate.push(i.finishrate);
          });

          var option = {
            title: {
              text: '工序计划排产完成情况',
              x: 'center',
              show: false,
              y: 0,
              textStyle: {
                color: '#000',
                fontSize: 24
              }
            },
            backgroundColor: 'rgba(128, 128, 128, 0)',
            tooltip: {
              trigger: 'axis',
              show: true,
              axisPointer: {
                type: 'shadow'
              }
            },
            grid: { // 画布与容器间隔设置
              left: '1%',
              right: '1%',
              bottom: '3%',
              containLabel: true
            },
            legend: {
              data: ['排产工序数', '按时完工工序数', '超期完工数', '未完工序数', '完成率'],
              x: '10',
              y: '5',
              textStyle: {
                fontSize: '14',
                fontWeight: 'bold'
              }
            },
            xAxis: [
              {
                type: 'category',
                data: arrWorkcenter,
                axisTick: {
                  alignWithLabel: true
                },
                axisLabel: {
                  show: true,
                  textStyle: {
                    color: '#000',
                    fontSize: '14',
                    fontWeight: 'bold'
                  }
                },
                axisLine: {
                  lineStyle: {
                    color: '#000',
                    width: '2'
                  }
                }
              }
            ],
            yAxis: [
              {
                type: 'value',
                axisLine: {
                  lineStyle: {
                    color: '#000',
                    width: '2'
                  }
                },
                axisLabel: {
                  show: true,
                  textStyle: {
                    color: '#000',
                    fontSize: '14',
                    fontWeight: 'bold'
                  }
                },
                splitLine: {
                  lineStyle: {
                    color: '#999',
                    type: 'dashed'
                  }
                }
              },
              {
                type: 'value',
                name: '完成率',
                axisLine: {
                  lineStyle: {
                    color: '#000',
                    width: '2'
                  }
                },
                splitLine: {
                  show: false
                },
                axisLabel: {
                  show: true,
                  formatter: function (data) {
                    return data + "%";
                  },
                  textStyle: {
                    color: '#000',
                    fontSize: '14',
                    fontWeight: 'bold'
                  }
                }
              }
            ],
            series: [
              {
                name: '排产工序数',
                animation: false,
                cursor: 'pointer',
                type: 'bar',
                barMaxWidth: 30,
                data: arrSpecCount,
                itemStyle: {
                  normal: {
                    color: '#1e90ff',
                    font: '16',
                    label: {
                      show: true,
                      color: '#1e90ff',
                      fontWeight: 'bolder',
                      position: 'top',
                      formatter: '{c}'
                    }
                  }
                }
              },
              {
                name: '按时完工工序数',
                animation: false,
                type: 'bar',
                barMaxWidth: 30,
                data: arrIntimeFinishCount,
                itemStyle: {
                  normal: {
                    color: '#00b000',
                    font: '16',
                    label: {
                      show: true,
                      color: '#00b000',
                      fontWeight: 'bolder',
                      position: 'top',
                      formatter: '{c}'
                    }
                  }
                }
              },
              {
                name: '超期完工数',
                animation: false,
                type: 'bar',
                barMaxWidth: 30,
                data: arrDelayfinishedSum,
                itemStyle: {
                  normal: {
                    color: '#ff6700',
                    font: '16',
                    label: {
                      show: true,
                      color: '#ff6700',
                      fontWeight: 'bolder',
                      position: 'top',
                      formatter: '{c}'
                    }
                  }
                }
              },
              {
                name: '未完工序数',
                animation: false,
                type: 'bar',
                barMaxWidth: 30,
                data: arrNotFinishCount,
                itemStyle: {
                  normal: {
                    color: 'red',
                    font: '16',
                    label: {
                      show: true,
                      color: 'red',
                      fontWeight: 'bolder',
                      position: 'top',
                      formatter: '{c}'
                    }
                  }
                }
              },
              {
                name: '完成率',
                animation: false,
                type: 'line',
                barMaxWidth: 30,
                yAxisIndex: 1,
                symbol: 'circle',
                symbolSize: 10,
                data: arrFinishRate,
                itemStyle: {
                  normal: {
                    color: '#FF1493',
                    font: '16',
                    label: {
                      show: true,
                      color: '#FF1493',
                      fontWeight: 'bolder',
                      position: 'top',
                      formatter: '{c}%'
                    }
                  }
                }
              }
            ]
          };
          chart.setOption(option);
        },

        async getShipPlanChartData() {
          this.loading = true
          this.loadingText = '数据加载中...'
          echarts.dispose(document.getElementById("shipPlanChart"));
          let chart = echarts.init(document.getElementById('shipPlanChart'));
          chart.showLoading({
            text: '数据查询中...',
            effect: 'whirling',
            maskColor: 'transparent',
            textColor: '#ffffff'
          });

          const { data: res } = await axios({
            url: '../handler/board/StatusOfProductionDashBoard.ashx?actions=getShipPlanChartData',
            method: 'post',
            data: {
              type: 'getShipPlanChartData',
              ...this.queryInfo
            }
          })

          this.loading = false
          chart.hideLoading();
          if (res.meta.status === 500) {
            return this.$message.error(res.meta.msg)
          }
          let arrWorkcenter = [], arrShipSpecCount = [], arrHaveShipedCount = [], arrdelayShipedCount = [],
            arrintimeShipedCount = [], arrnotPlanSpecCount = [];

          res.data.forEach(i => {
            arrWorkcenter.push(i.workcentername);
            arrShipSpecCount.push(i.shipspeccount);
            arrHaveShipedCount.push(i.haveshipedcount);
            arrdelayShipedCount.push(i.delayshipedcount);
            arrintimeShipedCount.push(i.intimeshipedcount);
            arrnotPlanSpecCount.push(i.notplanspeccount);
          });

          var option = {
            title: {
              text: '转工计划排产完成情况',
              x: 'center',
              show: false,
              y: 0,
              textStyle: {
                color: '#000',
                fontSize: 24
              }
            },
            backgroundColor: 'rgba(128, 128, 128, 0)',
            tooltip: {
              trigger: 'axis',
              show: true,
              axisPointer: {
                type: 'shadow'
              }
            },
            grid: { // 画布与容器间隔设置
              left: '1%',
              right: '1%',
              bottom: '3%',
              containLabel: true
            },
            legend: {
              data: ['计划发出项', '实际发出项', '超期发出项', '按计划发出项', '未在计划内发出项'],
              x: '10',
              y: '5',
              textStyle: {
                fontSize: '14',
                fontWeight: 'bold'
              }
            },
            xAxis: [
              {
                type: 'category',
                //data: ['结构件', '齿轮', '标准件', '安装座', '新机'],
                data: arrWorkcenter,
                axisTick: {
                  alignWithLabel: true
                },
                axisLabel: {
                  show: true,
                  textStyle: {
                    color: '#000',
                    fontSize: '14',
                    fontWeight: 'bold'
                  }
                },
                axisLine: {
                  lineStyle: {
                    color: '#000',
                    width: '2'
                  }
                }
              }
            ],
            yAxis: [
              {
                type: 'value',
                axisLine: {
                  lineStyle: {
                    color: '#000',
                    width: '2'
                  }
                },
                axisLabel: {
                  show: true,
                  textStyle: {
                    color: '#000',
                    fontSize: '14',
                    fontWeight: 'bold'
                  }
                },
                splitLine: {
                  lineStyle: {
                    color: '#999',
                    type: 'dashed'
                  }
                }
              }
            ],
            series: [
              {
                name: '计划发出项',
                animation: false,
                type: 'bar',
                barMaxWidth: 30,
                //data: [318, 606, 165, 154, 130],
                data: arrShipSpecCount,
                itemStyle: {
                  normal: {
                    color: '#1e90ff',
                    font: '16',
                    label: {
                      show: true,
                      color: '#1e90ff',
                      fontWeight: 'bolder',
                      position: 'top',
                      formatter: '{c}'
                    }
                  }
                }
              },
              {
                name: '实际发出项',
                animation: false,
                type: 'bar',
                barMaxWidth: 30,
                //data: [104, 409, 37, 52, 68],
                data: arrHaveShipedCount,
                itemStyle: {
                  normal: {
                    color: '#0000FF',
                    font: '16',
                    label: {
                      show: true,
                      color: '#0000FF',
                      fontWeight: 'bolder',
                      position: 'top',
                      formatter: '{c}'
                    }
                  }
                }
              },
              {
                name: '超期发出项',
                animation: false,
                type: 'bar',
                barMaxWidth: 30,
                //data: [55, 148, 4, 31, 14],
                data: arrdelayShipedCount,
                itemStyle: {
                  normal: {
                    color: '#ff6700',
                    font: '16',
                    label: {
                      show: true,
                      color: '#ff6700',
                      fontWeight: 'bolder',
                      position: 'top',
                      formatter: '{c}'
                    }
                  }
                }
              },
              {
                name: '按计划发出项',
                animation: false,
                type: 'bar',
                barMaxWidth: 30,
                //data: [214, 137, 128, 102, 62],
                data: arrintimeShipedCount,
                itemStyle: {
                  normal: {
                    color: '#00b000',
                    font: '16',
                    label: {
                      show: true,
                      color: '#00b000',
                      fontWeight: 'bolder',
                      position: 'top',
                      formatter: '{c}'
                    }
                  }
                }
              },
              {
                name: '未在计划内发出项',
                animation: false,
                type: 'bar',
                barMaxWidth: 30,
                //data: [45, 50, 55, 56.8, 99.8],
                data: arrnotPlanSpecCount,
                itemStyle: {
                  normal: {
                    color: '#000',
                    font: '16',
                    label: {
                      show: true,
                      color: '#000',
                      fontWeight: 'bolder',
                      position: 'top',
                      formatter: '{c}'
                    }
                  }
                }
              }
            ]
          };

          chart.setOption(option);
        },

        async getProblemChartData() {
          this.loading = true
          this.loadingText = '数据加载中...'
          echarts.dispose(document.getElementById("problemChart"));
          let chart = echarts.init(document.getElementById('problemChart'));
          chart.showLoading({
            text: '数据查询中...',
            effect: 'whirling',
            maskColor: 'transparent',
            textColor: '#ffffff'
          });

          const { data: res } = await axios({
            url: '../handler/board/StatusOfProductionDashBoard.ashx?actions=getProblemChartData',
            method: 'post',
            data: {
              type: 'getProblemChartData',
              ...this.queryInfo
            }
          })

          this.loading = false
          chart.hideLoading();
          if (res.meta.status === 500) {
            return this.$message.error(res.meta.msg)
          }

          let arrWorkcenter = [],
            arrTotalCount = [],
            arrFinishedCount = [],
            arrNotdealedCount = [],
            arrClosedCount = [],
            arrDelayCount = [],
            arrReplyRate = [];

          res.data.forEach(i => {
            arrWorkcenter.push(i.workcentername);
            arrTotalCount.push(i.totalcount);
            arrFinishedCount.push(i.finishedcount);
            arrNotdealedCount.push(i.notdealedcount);
            arrClosedCount.push(i.closedcount);
            arrDelayCount.push(i.delaycount);
            arrReplyRate.push(i.replyrate);
          });
          var option = {
            title: {
              text: '工区协作',
              x: 'center',
              show: false,
              y: 0,
              textStyle: {
                color: '#000',
                fontSize: 24
              }
            },
            backgroundColor: 'rgba(128, 128, 128, 0)',
            tooltip: {
              trigger: 'axis',
              show: true,
              axisPointer: {
                type: 'shadow'
              }
            },
            grid: { // 画布与容器间隔设置
              left: '1%',
              right: '1%',
              bottom: '3%',
              containLabel: true
            },
            legend: {
              data: ['总项数', '处理完', '处理中/未处理', '已关闭', '超期项数', '回复完成率'],
              x: '10',
              y: '5',
              textStyle: {
                fontSize: '14',
                fontWeight: 'bold'
              }
            },
            xAxis: [
              {
                type: 'category',
                //data: ['结构件', '齿轮', '标准件', '安装座', '新机', '技术处', '质量处', '综合处'],
                data: arrWorkcenter,
                axisTick: {
                  alignWithLabel: true
                },
                axisLabel: {
                  show: true,
                  textStyle: {
                    color: '#000',
                    fontSize: '14',
                    fontWeight: 'bold'
                  }
                },
                axisLine: {
                  lineStyle: {
                    color: '#000',
                    width: '2'
                  }
                }
              }
            ],
            yAxis: [
              {
                type: 'value',
                axisLine: {
                  lineStyle: {
                    color: '#000',
                    width: '2'
                  }
                },
                axisLabel: {
                  show: true,
                  textStyle: {
                    color: '#000',
                    fontSize: '14',
                    fontWeight: 'bold'
                  }
                },
                splitLine: {
                  lineStyle: {
                    color: '#999',
                    type: 'dashed'
                  }
                }
              },
              {
                type: 'value',
                name: '完成率',
                axisLine: {
                  lineStyle: {
                    color: '#000',
                    width: '2'
                  }
                },
                splitLine: {
                  show: false
                },
                axisLabel: {
                  show: true,
                  formatter: function (data) {
                    return data + "%";
                  },
                  textStyle: {
                    color: '#000',
                    fontSize: '14',
                    fontWeight: 'bold'
                  }
                }
              }
            ],
            series: [
              {
                name: '总项数',
                animation: false,
                type: 'bar',
                barMaxWidth: 30,
                //data: [318, 606, 165, 154, 130, 89, 34, 45],
                data: arrTotalCount,
                itemStyle: {
                  normal: {
                    color: '#1e90ff',
                    font: '16',
                    label: {
                      show: true,
                      color: '#1e90ff',
                      fontWeight: 'bolder',
                      position: 'top',
                      formatter: '{c}'
                    }
                  }
                }
              },
              {
                name: '处理完',
                animation: false,
                type: 'bar',
                barMaxWidth: 30,
                //data: [104, 409, 37, 52, 68, 33, 22, 67],
                data: arrFinishedCount,
                itemStyle: {
                  normal: {
                    color: '#00b000',
                    font: '16',
                    label: {
                      show: true,
                      color: '#00b000',
                      fontWeight: 'bolder',
                      position: 'top',
                      formatter: '{c}'
                    }
                  }
                }
              },
              {
                name: '处理中/未处理',
                animation: false,
                type: 'bar',
                barMaxWidth: 30,
                //data: [55, 148, 4, 31, 14, 20, 56, 45],
                data: arrNotdealedCount,
                itemStyle: {
                  normal: {
                    color: '#ff6700',
                    font: '16',
                    label: {
                      show: true,
                      color: '#ff6700',
                      fontWeight: 'bolder',
                      position: 'top',
                      formatter: '{c}'
                    }
                  }
                }
              },
              {
                name: '已关闭',
                animation: false,
                type: 'bar',
                barMaxWidth: 30,
                //data: [214, 137, 128, 102, 62, 45, 23, 31],
                data: arrClosedCount,
                itemStyle: {
                  normal: {
                    color: '#333',
                    font: '16',
                    label: {
                      show: true,
                      color: '#333',
                      fontWeight: 'bolder',
                      position: 'top',
                      formatter: '{c}'
                    }
                  }
                }
              },
              {
                name: '超期项数',
                animation: false,
                type: 'bar',
                barMaxWidth: 30,
                //data: [214, 137, 128, 102, 62, 56, 78, 90],
                data: arrDelayCount,
                itemStyle: {
                  normal: {
                    color: 'red',
                    font: '16',
                    label: {
                      show: true,
                      color: 'red',
                      fontWeight: 'bolder',
                      position: 'top',
                      formatter: '{c}'
                    }
                  }
                }
              },
              {
                name: '回复完成率',
                animation: false,
                type: 'line',
                barMaxWidth: 30,
                yAxisIndex: 1,
                symbol: 'circle',
                //symbol: 'emptyCircle', //['circle','rect','emptyCircle']
                symbolSize: 10,
                //data: [98, 89, 78, 56.8, 78, 56, 78, 34],
                data: arrReplyRate,
                itemStyle: {
                  normal: {
                    color: '#FF1493',
                    font: '16',
                    label: {
                      show: true,
                      color: '#FF1493',
                      fontWeight: 'bolder',
                      position: 'top',
                      formatter: '{c}%'
                    }
                  }
                }
              }
            ]
          };
          chart.setOption(option);
        },

        async getWorkcenterCoop() {
          this.loading = true
          this.loadingText = '数据加载中...'
          echarts.dispose(document.getElementById("workcenterCoopChart"));
          let chart = echarts.init(document.getElementById('workcenterCoopChart'));
          chart.showLoading({
            text: '数据查询中...',
            effect: 'whirling',
            maskColor: 'transparent',
            textColor: '#ffffff'
          });

          const { data: res } = await axios({
            url: '../handler/board/StatusOfProductionDashBoard.ashx?actions=getWorkcenterCoop',
            method: 'post',
            data: {
              type: 'getWorkcenterCoop',
              ...this.queryInfo
            }
          })

          this.loading = false
          chart.hideLoading();
          if (res.meta.status === 500) {
            return this.$message.error(res.meta.msg)
          }

          let arrWorkcenter = [],
            arrApplyCount = [],
            arrAcepCount = [],
            arrCompleteCount = [],
            arrNotCompleteCount = [],
            arrCompleteRate = [];

          res.data.forEach(i => {
            arrWorkcenter.push(i.workcentername);
            arrApplyCount.push(i.applycount);
            arrAcepCount.push(i.aceptcount);
            arrCompleteCount.push(i.completecount);
            arrNotCompleteCount.push(i.notcompletecount);
            arrCompleteRate.push(i.completerate);
          });

          var option = {
            title: {
              text: '工区协作',
              x: 'center',
              show: false,
              y: 0,
              textStyle: {
                color: '#000',
                fontSize: 24
              }
            },
            backgroundColor: 'rgba(128, 128, 128, 0)',
            tooltip: {
              trigger: 'axis',
              show: true,
              axisPointer: {
                type: 'shadow'
              }
            },
            grid: { // 画布与容器间隔设置
              left: '1%',
              right: '1%',
              bottom: '3%',
              containLabel: true
            },
            legend: {
              data: ['申请项数', '接收申请项数', '完工项数', '未完项数', '完成率'],
              x: '10',
              y: '5',
              textStyle: {
                fontSize: '14',
                fontWeight: 'bold'
              }
            },
            xAxis: [
              {
                type: 'category',
                //data: ['结构件', '齿轮', '标准件', '安装座', '新机'],
                data: arrWorkcenter,
                axisTick: {
                  alignWithLabel: true
                },
                axisLabel: {
                  show: true,
                  textStyle: {
                    color: '#000',
                    fontSize: '14',
                    fontWeight: 'bold'
                  }
                },
                axisLine: {
                  lineStyle: {
                    color: '#000',
                    width: '2'
                  }
                }
              }
            ],
            yAxis: [
              {
                type: 'value',
                axisLine: {
                  lineStyle: {
                    color: '#000',
                    width: '2'
                  }
                },
                axisLabel: {
                  show: true,
                  textStyle: {
                    color: '#000',
                    fontSize: '14',
                    fontWeight: 'bold'
                  }
                },
                splitLine: {
                  lineStyle: {
                    color: '#999',
                    type: 'dashed'
                  }
                }
              },
              {
                type: 'value',
                name: '完成率',
                axisLine: {
                  lineStyle: {
                    color: '#000',
                    width: '2'
                  }
                },
                splitLine: {
                  show: false
                },
                axisLabel: {
                  show: true,
                  formatter: function (data) {
                    return data + "%";
                  },
                  textStyle: {
                    color: '#000',
                    fontSize: '14',
                    fontWeight: 'bold'
                  }
                }
              }
            ],
            series: [
              {
                name: '申请项数',
                animation: false,
                type: 'bar',
                barMaxWidth: 30,
                //data: [318, 606, 165, 154, 130],
                data: arrApplyCount,
                itemStyle: {
                  normal: {
                    color: '#1e90ff',
                    font: '16',
                    label: {
                      show: true,
                      color: '#1e90ff',
                      fontWeight: 'bolder',
                      position: 'top',
                      formatter: '{c}'
                    }
                  }
                }
              },
              {
                name: '接收申请项数',
                animation: false,
                type: 'bar',
                barMaxWidth: 30,
                //data: [104, 409, 37, 52, 68],
                data: arrAcepCount,
                itemStyle: {
                  normal: {
                    color: '#333',
                    font: '16',
                    label: {
                      show: true,
                      color: '#333',
                      fontWeight: 'bolder',
                      position: 'top',
                      formatter: '{c}'
                    }
                  }
                }
              },
              {
                name: '完工项数',
                animation: false,
                type: 'bar',
                barMaxWidth: 30,
                //data: [55, 148, 4, 31, 14],
                data: arrCompleteCount,
                itemStyle: {
                  normal: {
                    color: '#00b000',
                    font: '16',
                    label: {
                      show: true,
                      color: '#00b000',
                      fontWeight: 'bolder',
                      position: 'top',
                      formatter: '{c}'
                    }
                  }
                }
              },
              {
                name: '未完项数',
                animation: false,
                type: 'bar',
                barMaxWidth: 30,
                //data: [214, 137, 128, 102, 62],
                data: arrNotCompleteCount,
                itemStyle: {
                  normal: {
                    color: 'red',
                    font: '16',
                    label: {
                      show: true,
                      color: 'red',
                      fontWeight: 'bolder',
                      position: 'top',
                      formatter: '{c}'
                    }
                  }
                }
              },
              {
                name: '完成率',
                animation: false,
                type: 'line',
                barMaxWidth: 30,
                yAxisIndex: 1,
                symbol: 'circle',
                //symbol: 'emptyCircle', //['circle','rect','emptyCircle']
                symbolSize: 10,
                //data: [98, 89, 78, 56.8, 78],
                data: arrCompleteRate,
                itemStyle: {
                  normal: {
                    color: '#FF1493',
                    font: '16',
                    label: {
                      show: true,
                      color: '#FF1493',
                      fontWeight: 'bolder',
                      position: 'top',
                      formatter: '{c}%'
                    }
                  }
                }
              }
            ]
          };
          chart.setOption(option);
        },
        handleBtnSearch() {
          this.getStepPlanChartData()
          this.getShipPlanChartData()
          this.getProblemChartData()
          this.getWorkcenterCoop()
        },
        factorySelectChange(val) {
          if (val) {
            this.queryInfo.factoryname = this.factoryList.filter(item => item.factoryid === val)[0].factoryname
          }
        }
      },
      mounted() {
        let incrementNumber = () => {
          setTimeout(incrementNumber, 500);
          this.currentTime = dayjs().format('YYYY年MM月DD日  HH:mm:ss');
        }
        setTimeout(incrementNumber, 500);
        const monday = dayjs().startOf('week').format('YYYY-MM-DD')
        const sunday = dayjs().endOf('week').format('YYYY-MM-DD')
        this.queryInfo.selectdate = [monday, sunday]
        const uid = getParams("uid")
        this.getUserInfo(uid).then(() => {
          this.getFactoryList().then(() => {
            if (this.userInfo.factoryid && this.factoryList.some(item => item.factoryid === this.userInfo.factoryid)) {
              const { factoryid, factoryname } = this.userInfo;
              this.queryInfo.factoryid = factoryid
              this.queryInfo.factoryname = factoryname
            } else {
              this.queryInfo.factoryid = this.factoryList[0].factoryid;
              this.queryInfo.factoryname = this.factoryList[0].factoryname;
            }
            this.getStepPlanChartData()
            this.getShipPlanChartData()
            this.getProblemChartData()
            this.getWorkcenterCoop()
          });
        })
      },
      computed: {
        title() { return this.queryInfo.factoryname + '生产完成情况看板' }
      }
    })
  </script>
</body>

</html>